# 5种数据容器都支持for循环遍历
# while循环只有列表，字符串，元组支持
# 集合和字典不支持while循环，因为集合和字典没有下标，无法进行下标检索

# 5种数据容器都支持len(),max(),min()
my_list = [1, 2, 3, 4, 5, 6]
my_tuple = ("a", "b", "c", "d", "e")
my_string = "rxyhahahah"
my_set = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
my_dick = {"111": 11.1, "222": 22.2, "333": 33.3}

# len()
print(len(my_list))
print(len(my_tuple))
print(len(my_string))
print(len(my_set))
print(len(my_dick))

print("\n")
# max()
print(max(my_list))
print(max(my_tuple))
print(max(my_string))
print(max(my_set))
print(max(my_dick))

print("\n")
# min()
print(min(my_list))
print(min(my_tuple))
print(min(my_string))
print(min(my_set))
print(min(my_dick))

# 容器可以通用转换
# list(),str(),tuple(),set()
print(f"列表转列表：{list(my_list)}")
print(f"元组转列表：{list(my_tuple)}")
print(f"字符串转列表：{list(my_string)}")
print(f"集合转列表：{list(my_set)}")
print(f"字典转列表：{list(my_dick)}")
print("\n")

print(f"列表转字符串：{str(my_list)}")
print(f"元组转字符串：{str(my_tuple)}")
print(f"字符串转字符串：{str(my_string)}")
print(f"集合转字符串：{str(my_set)}")
print(f"字典转字符串：{str(my_dick)}")
print("\n")

print(f"列表转集合：{set(my_list)}")
print(f"元组转集合：{set(my_tuple)}")
print(f"字符串转集合：{set(my_string)}")
print(f"集合转集合：{set(my_set)}")
print(f"字典转集合：{set(my_dick)}")
print("\n")

print(f"列表转元组：{tuple(my_list)}")
print(f"元组转元组：{tuple(my_tuple)}")
print(f"字符串转元组：{tuple(my_string)}")
print(f"集合转元组：{tuple(my_set)}")
print(f"字典转元组：{tuple(my_dick)}")
print("\n")
# 通用排序功能
# sorted（容器，[reverse=True]）
# 排序后都变成列表
my_list = [3, 4, 6, 8, 9, 2, 1]
my_tuple = ("a", "b", "c", "d", "e")
my_string = "rxyhahahah"
my_set = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
my_dick = {"111": 11.1, "222": 22.2, "333": 33.3}
print(f"列表：{sorted(my_list)}")
print(f"元组：{sorted(my_tuple)}")
print(f"字符串：{sorted(my_string)}")
print(f"集合：{sorted(my_set)}")
print(f"字典：{sorted(my_dick)}")
print("\n")
print(f"列表：{sorted(my_list,reverse=True)}")
print(f"元组：{sorted(my_tuple,reverse=True)}")
print(f"字符串：{sorted(my_string,reverse=True)}")
print(f"集合：{sorted(my_set,reverse=True)}")
print(f"字典：{sorted(my_dick,reverse=True)}")
